FROM alpine:3.14.3

LABEL maintainer="zhangyu-2021/11/30"

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
      apk add --no-cache tzdata libc6-compat && \
      ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
      echo "Asia/Shanghai" >> /etc/timezone && \
      echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf \
      && adduser -g yearning -D -h /home/yearning  yearning

WORKDIR /home/yearning
COPY --chown=yearning Yearning  /home/yearning/Yearning
COPY --chown=yearning conf.toml /home/yearning/conf.toml
USER yearning

EXPOSE 8000
CMD /home/yearning/Yearning install && /home/yearning/Yearning run